<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">
  <meta name="baidu-site-verification" content="code-oLqr5o013S">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"shaojunying.github.io","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":true,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="看了自动部署Gitee Pages脚本,分析并模拟Gitee Pages登录">
<meta property="og:type" content="article">
<meta property="og:title" content="gitee的模拟登录">
<meta property="og:url" content="https://shaojunying.github.io/2020/10/07/gitee%E7%9A%84%E6%A8%A1%E6%8B%9F%E7%99%BB%E5%BD%95/index.html">
<meta property="og:site_name" content="Shaojunying&#39;s Blog">
<meta property="og:description" content="看了自动部署Gitee Pages脚本,分析并模拟Gitee Pages登录">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-10-07T08:29:16.000Z">
<meta property="article:modified_time" content="2021-04-04T05:42:02.663Z">
<meta property="article:author" content="邵俊颖">
<meta property="article:tag" content="爬虫">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://shaojunying.github.io/2020/10/07/gitee%E7%9A%84%E6%A8%A1%E6%8B%9F%E7%99%BB%E5%BD%95/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>gitee的模拟登录 | Shaojunying's Blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<link rel="alternate" href="/atom.xml" title="Shaojunying's Blog" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Shaojunying's Blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">35</span></a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">55</span></a>

  </li>
        <li class="menu-item menu-item-sitemap">

    <a href="/sitemap.xml" rel="section"><i class="fa fa-sitemap fa-fw"></i>站点地图</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <a role="button" class="book-mark-link book-mark-link-fixed"></a>

  <a href="https://github.com/shaojunying" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://shaojunying.github.io/2020/10/07/gitee%E7%9A%84%E6%A8%A1%E6%8B%9F%E7%99%BB%E5%BD%95/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="邵俊颖">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Shaojunying's Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          gitee的模拟登录
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-10-07 16:29:16" itemprop="dateCreated datePublished" datetime="2020-10-07T16:29:16+08:00">2020-10-07</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2021-04-04 13:42:02" itemprop="dateModified" datetime="2021-04-04T13:42:02+08:00">2021-04-04</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>看了<a target="_blank" rel="noopener" href="https://github.com/yanglbme/gitee-pages-action">自动部署Gitee Pages脚本</a>,分析并模拟Gitee Pages登录</p>
<a id="more"></a>

<h2 id="分析POST请求"><a href="#分析POST请求" class="headerlink" title="分析POST请求"></a>分析POST请求</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">encrypt_key: password</span><br><span class="line">utf8: ✓</span><br><span class="line">authenticity_token: jyna10uRx6nksFsKrOXOGlTaH1en+FjlrfBunGv6j5M&#x3D;</span><br><span class="line">redirect_to_url: </span><br><span class="line">user[login]: shaojunying</span><br><span class="line">encrypt_data[user[password]]: Yb5KLQgGxbEM8M3kVn00yVuNJwjQ4vWjYjPbJj1O9wh5au1cXd1eVb+WJkOfWfio4q&#x2F;2t7mOVCpH70cv5NtrNPw5ZW4lkj&#x2F;JJOt3L9w6P4RU3tQpB4fqofP&#x2F;j5BhU1C4FJLpylSENdMj2Lf5S5PUTA18QF1ykrpaqgKqrejZtRE&#x3D;</span><br><span class="line">user[remember_me]: 0</span><br></pre></td></tr></table></figure>

<p>上面是login的post请求中的form-data,分析可知<code>user[login]</code>表示的是用户名,而<code>encrypt_data[user[password]]</code>是加密之后的密码,需要在之前的页面中找encrypt_data.</p>
<p>在network中全局搜索encrypt_data,发现请求<code>https://assets.gitee.com/assets/encrypt-b4407d80fc0fd4eb67c8709f21684588.js</code>包含encrypt_data关键字,下面是定位到的代码段,在注释中对代码进行分析.</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br></pre></td><td class="code"><pre><span class="line">$(<span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">    <span class="keyword">if</span> (<span class="built_in">window</span>.gon &amp;&amp; <span class="built_in">window</span>.gon.encrypt &amp;&amp; <span class="built_in">window</span>.gon.encrypt.enabled) &#123;</span><br><span class="line">        <span class="keyword">var</span> t = <span class="keyword">new</span> <span class="built_in">window</span>.JSEncrypt</span><br><span class="line">          , e = <span class="built_in">window</span>.gon.encrypt.separator</span><br><span class="line">          , i = <span class="built_in">window</span>.gon.encrypt.password_key</span><br><span class="line">          , r = $(<span class="string">&quot;meta[name=csrf-token]&quot;</span>)[<span class="number">0</span>].content</span><br><span class="line">          , n = <span class="string">&#x27;&lt;input type=&quot;hidden&quot; name=&quot;encrypt_key&quot;&gt;&#x27;</span></span><br><span class="line">          , s = <span class="string">&#x27;&lt;input type=&quot;hidden&quot; name=&quot;encrypt_data[$name]&quot;&gt;&#x27;</span>;</span><br><span class="line">        <span class="comment">// 遍历每一个设置了属性 data-encrypt=&quot;true&quot;的form,对其中的password加密</span></span><br><span class="line">        $(<span class="string">&quot;form[data-encrypt=true]&quot;</span>).each(<span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">            <span class="keyword">var</span> o = $(<span class="built_in">this</span>)</span><br><span class="line">              , h = $(n)</span><br><span class="line">              , a = o.data(<span class="string">&quot;key&quot;</span>);</span><br><span class="line">            <span class="keyword">switch</span> (a) &#123;</span><br><span class="line">            <span class="keyword">case</span> <span class="string">&quot;password&quot;</span>:</span><br><span class="line">                <span class="comment">// i是public_key,通过查询可知定义在get https://gitee.com/login请求中</span></span><br><span class="line">                t.setPublicKey(i),</span><br><span class="line">                <span class="comment">// h是一个新的隐式input,之后内容是&lt;input type=&quot;hidden&quot; name=&quot;encrypt_key&quot; value=&quot;password&quot;&gt;</span></span><br><span class="line">                h.val(a);</span><br><span class="line">                <span class="keyword">break</span>;</span><br><span class="line">            <span class="keyword">default</span>:</span><br><span class="line">                <span class="keyword">return</span></span><br><span class="line">            &#125;</span><br><span class="line">            o.prepend(h),</span><br><span class="line">            $(<span class="string">&quot;[data-encrypt=true]&quot;</span>, o).each(<span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">                <span class="comment">// 加密表单中需要加密的项</span></span><br><span class="line"></span><br><span class="line">                <span class="comment">// 表单项对应的元素,一般为input</span></span><br><span class="line">                <span class="keyword">var</span> i = $(<span class="built_in">this</span>)</span><br><span class="line">                    <span class="comment">// 表单项的名字</span></span><br><span class="line">                  , n = i.attr(<span class="string">&quot;name&quot;</span>)</span><br><span class="line">                  <span class="comment">// 为加密后的元素创建一个表单项(之后提交时将作为请求参数)</span></span><br><span class="line">                  <span class="comment">// &lt;input type=&quot;hidden&quot; name=&quot;encrypt_data[user[password]]&quot; value=&quot;*****&quot;&gt;</span></span><br><span class="line">                  , o = $(s.replace(<span class="string">&quot;$name&quot;</span>, n));</span><br><span class="line">                i.before(o),</span><br><span class="line">                <span class="comment">// 监听要加密的表单项,一旦发生变化就修改加密之后的元素值</span></span><br><span class="line">                i.change(<span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">                    <span class="comment">// r是X-CSRF-Token,get登录页面时可以得到该值</span></span><br><span class="line">                    <span class="comment">// e是分隔符,也是在get登录页面时获取</span></span><br><span class="line">                    <span class="comment">// i是用户输入的原始密码</span></span><br><span class="line">                    <span class="comment">// 之后将三者拼接并为加密之后的结果创建新input</span></span><br><span class="line">                    <span class="keyword">var</span> n = t.encrypt(r + e + i.val());</span><br><span class="line">                    o.val(n),</span><br><span class="line">                    i.removeAttr(<span class="string">&quot;name&quot;</span>)</span><br><span class="line">                &#125;)</span><br><span class="line">            &#125;)</span><br><span class="line">        &#125;)</span><br><span class="line">    &#125;</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>

<h2 id="分析登录的get请求"><a href="#分析登录的get请求" class="headerlink" title="分析登录的get请求"></a>分析登录的get请求</h2><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">meta</span> <span class="attr">content</span>=<span class="string">&quot;authenticity_token&quot;</span> <span class="attr">name</span>=<span class="string">&quot;csrf-param&quot;</span> /&gt;</span></span><br><span class="line"><span class="comment">&lt;!-- 就是post需要的X-CSRF-Token --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">meta</span> <span class="attr">content</span>=<span class="string">&quot;dBWUUHIYc94LTKTOEnAZkxvyntZgqFN5cNli2S9DLUQ=&quot;</span> <span class="attr">name</span>=<span class="string">&quot;csrf-token&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">link</span> <span class="attr">href</span>=<span class="string">&quot;https://assets.gitee.com/assets/application-f5fd3f1c2641f843a7ce17e94fa11583.css&quot;</span> <span class="attr">media</span>=<span class="string">&quot;all&quot;</span> <span class="attr">rel</span>=<span class="string">&quot;stylesheet&quot;</span> /&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">script</span>&gt;</span></span><br><span class="line"><span class="javascript"><span class="comment">// separator,password_key都在这里面可以找到</span></span></span><br><span class="line"><span class="javascript"><span class="comment">//&lt;![CDATA[</span></span></span><br><span class="line"><span class="javascript"><span class="built_in">window</span>.gon = &#123;&#125;;gon.locale=<span class="string">&quot;zh-CN&quot;</span>;gon.sentry_dsn=<span class="literal">null</span>;gon.baidu_register_hm_push=<span class="literal">null</span>;gon.info=&#123;<span class="string">&quot;controller_path&quot;</span>:<span class="string">&quot;sessions&quot;</span>,<span class="string">&quot;action_name&quot;</span>:<span class="string">&quot;new&quot;</span>,<span class="string">&quot;current_user&quot;</span>:<span class="literal">false</span>&#125;;gon.tour_env=&#123;<span class="string">&quot;current_user&quot;</span>:<span class="literal">null</span>,<span class="string">&quot;action_name&quot;</span>:<span class="string">&quot;new&quot;</span>,<span class="string">&quot;original_url&quot;</span>:<span class="string">&quot;http://gitee.com/login&quot;</span>,<span class="string">&quot;controller_path&quot;</span>:<span class="string">&quot;sessions&quot;</span>&#125;;gon.yunpian_key=<span class="literal">false</span>;gon.encrypt=&#123;<span class="string">&quot;enabled&quot;</span>:<span class="literal">true</span>,<span class="string">&quot;separator&quot;</span>:<span class="string">&quot;$gitee$&quot;</span>,<span class="string">&quot;password_key&quot;</span>:<span class="string">&quot;-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIrn+WB2Yi4ABAL5Tq6E09tumY\nqVTFdpU01kCDUmClczJOCGZriLNMrshmN9NJxazpqizPthwS1OIK3HwRLEP9D3GL\n7gCnvN6lpIpoVwppWd65f/rK2ewv6dstN0fCmtVj4WsLUchWlgNuVTfWljiBK/Dc\nYkfslRZzCq5Fl3ooowIDAQAB\n-----END PUBLIC KEY-----\n&quot;</span>&#125;;</span></span><br></pre></td></tr></table></figure>

<h2 id="Python模拟页面的登录请求"><a href="#Python模拟页面的登录请求" class="headerlink" title="Python模拟页面的登录请求"></a>Python模拟页面的登录请求</h2><p>网页中使用的是JSEncrypt库,而python中使用的库是rsa.</p>
<ul>
<li>通过<a target="_blank" rel="noopener" href="https://www.jianshu.com/p/7a4645691c68">博客</a>可知可以使用<code>public_key = rsa.PublicKey.load_pkcs1_openssl_pem(PUBLIC_KEY.encode())</code>函数设置公钥.</li>
<li>通过<a target="_blank" rel="noopener" href="https://blog.csdn.net/Enderman_xiaohei/article/details/89325747">博客</a>可知,可以使用  <figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">data = <span class="string">&quot;rtU/xUiVseZhYLnpC6UncwKVba6aUQEC9II7OnLgLpQ=&quot;</span> + <span class="string">&quot;$gitee$&quot;</span> + <span class="string">&quot;password&quot;</span></span><br><span class="line">data = rsa.encrypt(data.encode(), public_key)</span><br><span class="line">data = base64.b64encode(data).decode()</span><br></pre></td></tr></table></figure>
  的方法获取加密之后的字符串.其余的直接使用requests库发送相应的请求即可</li>
</ul>
<h2 id="代码"><a href="#代码" class="headerlink" title="代码"></a>代码</h2><p>最后的代码如下所示</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> base64</span><br><span class="line"><span class="keyword">import</span> rsa</span><br><span class="line"></span><br><span class="line">PUBLIC_KEY = <span class="string">&quot;-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIrn+WB2Yi4ABAL5Tq6E09tumY&quot;</span> \</span><br><span class="line">             <span class="string">&quot;\nqVTFdpU01kCDUmClczJOCGZriLNMrshmN9NJxazpqizPthwS1OIK3HwRLEP9D3GL\n7gCnvN6lpIpoVwppWd65f&quot;</span> \</span><br><span class="line">             <span class="string">&quot;/rK2ewv6dstN0fCmtVj4WsLUchWlgNuVTfWljiBK/Dc\nYkfslRZzCq5Fl3ooowIDAQAB\n-----END PUBLIC KEY-----\n &quot;</span></span><br><span class="line">public_key = rsa.PublicKey.load_pkcs1_openssl_pem(PUBLIC_KEY.encode())</span><br><span class="line">data = <span class="string">&quot;rtU/xUiVseZhYLnpC6UncwKVba6aUQEC9II7OnLgLpQ=&quot;</span> + <span class="string">&quot;$gitee$&quot;</span> + <span class="string">&quot;ddfbhjvdbghd&quot;</span></span><br><span class="line">data = rsa.encrypt(data.encode(), public_key)</span><br><span class="line">data = base64.b64encode(data).decode()</span><br><span class="line"></span><br><span class="line">print(data)</span><br></pre></td></tr></table></figure>
<p>有些变量在这里被写死了,实际需要通过get请求获取,稍加修改即可.</p>

    </div>

    
    
    

      <footer class="post-footer">
          
          <div class="post-tags">
              <a href="/tags/%E7%88%AC%E8%99%AB/" rel="tag"><i class="fa fa-tag"></i> 爬虫</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/10/06/redis%E7%9A%84AOF%E6%8C%81%E4%B9%85%E5%8C%96%E5%AD%98%E5%82%A8/" rel="prev" title="redis的AOF持久化存储">
      <i class="fa fa-chevron-left"></i> redis的AOF持久化存储
    </a></div>
      <div class="post-nav-item">
    <a href="/2020/10/10/LeetCode-142-%E7%8E%AF%E5%BD%A2%E9%93%BE%E8%A1%A82/" rel="next" title="LeetCode 142 环形链表2">
      LeetCode 142 环形链表2 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%88%86%E6%9E%90POST%E8%AF%B7%E6%B1%82"><span class="nav-number">1.</span> <span class="nav-text">分析POST请求</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%88%86%E6%9E%90%E7%99%BB%E5%BD%95%E7%9A%84get%E8%AF%B7%E6%B1%82"><span class="nav-number">2.</span> <span class="nav-text">分析登录的get请求</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Python%E6%A8%A1%E6%8B%9F%E9%A1%B5%E9%9D%A2%E7%9A%84%E7%99%BB%E5%BD%95%E8%AF%B7%E6%B1%82"><span class="nav-number">3.</span> <span class="nav-text">Python模拟页面的登录请求</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BB%A3%E7%A0%81"><span class="nav-number">4.</span> <span class="nav-text">代码</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">邵俊颖</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">55</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">35</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/shaojunying" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;shaojunying" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i></a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:shaojunying1@gmail.com" title="E-Mail → mailto:shaojunying1@gmail.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i></a>
      </span>
      <span class="links-of-author-item">
        <a href="https://twitter.com/SHAOJY1999" title="Twitter → https:&#x2F;&#x2F;twitter.com&#x2F;SHAOJY1999" rel="noopener" target="_blank"><i class="fab fa-twitter fa-fw"></i></a>
      </span>
      <span class="links-of-author-item">
        <a href="https://stackoverflow.com/users/10499946/shao-junying" title="StackOverflow → https:&#x2F;&#x2F;stackoverflow.com&#x2F;users&#x2F;10499946&#x2F;shao-junying" rel="noopener" target="_blank"><i class="fab fa-stack-overflow fa-fw"></i></a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        
  <div class="beian"><a href="https://beian.miit.gov.cn/" rel="noopener" target="_blank">京ICP备2020041459号 </a>
  </div>

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">邵俊颖</span>
</div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>

<script src="/js/bookmark.js"></script>




  
  <script>
    (function(){
      var canonicalURL, curProtocol;
      //Get the <link> tag
      var x=document.getElementsByTagName("link");
		//Find the last canonical URL
		if(x.length > 0){
			for (i=0;i<x.length;i++){
				if(x[i].rel.toLowerCase() == 'canonical' && x[i].href){
					canonicalURL=x[i].href;
				}
			}
		}
    //Get protocol
	    if (!canonicalURL){
	    	curProtocol = window.location.protocol.split(':')[0];
	    }
	    else{
	    	curProtocol = canonicalURL.split(':')[0];
	    }
      //Get current URL if the canonical URL does not exist
	    if (!canonicalURL) canonicalURL = window.location.href;
	    //Assign script content. Replace current URL with the canonical URL
      !function(){var e=/([http|https]:\/\/[a-zA-Z0-9\_\.]+\.baidu\.com)/gi,r=canonicalURL,t=document.referrer;if(!e.test(r)){var n=(String(curProtocol).toLowerCase() === 'https')?"https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif":"//api.share.baidu.com/s.gif";t?(n+="?r="+encodeURIComponent(document.referrer),r&&(n+="&l="+r)):r&&(n+="?l="+r);var i=new Image;i.src=n}}(window);})();
  </script>




  
<script src="/js/local-search.js"></script>













  

  

</body>
</html>
